home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Night Owl 6
/
Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso
/
001a
/
hunt100.zip
/
HUNT.ASP
< prev
next >
Wrap
Text File
|
1991-11-13
|
11KB
|
448 lines
; HUNT.ASP Copyright (C) 1991 by Larry McElderry
; The following should contain the name of the directory (with trailing \)
; where your .HNT or .NOT configuration files are located
; As is, HUNT will look in the current directory. Change this if you
; plan to keep your configuration files in a different directory.
string configdir = ""
integer cnorm = 31
integer cerr = 79
integer cwin = 30
;************************************************************
; These are the variable paramaters that can be set from the configuration file
; Values are provided here to act as defaults. The config file name is made
; up from the capitalized letters of each variable name (note that the names
; themselves are not case sensitive). ie. rw = RingWait
integer RingWait = 5
string ModemSet = ""
string autoLOG = ""
long lowSPD = 300L
;************************************************************
; these variables will be set to Procomm's configuration settings
; There's no point in giving them values here, because they will
; be changed at startup. They can, however, be changed by the
; configuration files
integer ConnectWait
string ModemInit
;************************************************************
; the following are the nine numbers that will be dialed
; config file parms n1 through n9
string no1 = ""
string no2 = ""
string no3 = ""
string no4 = ""
string no5 = ""
string no6 = ""
string no7 = ""
string no8 = ""
string no9 = ""
;** don't mess with these variables
string PCdial
string PCsufx
integer PCauto
integer tooslow = 0
integer ln = 0
integer pos = 2
proc main
clear
kflush
set keys on
locate 0 0
atsay ln pos cnorm "HUNT.ASP Copyright (C) 1991 by Larry McElderry"
call pg
if not fromddir
atsay 21 pos cerr "ERROR: this script must be called from the dialing directory"
exit
endif
call config
locate 21 0
transmit "ATE0^M"
waitfor "OK" 10
if not waitfor
atsay 21 pos cerr "ERROR: modem did not respond to Local Echo Off command"
exit
endif
box 8 10 15 70 cwin
while forever
if not null no1
call dodial with no1
if connected
exitwhile
endif
endif
if not null no2
call dodial with no2
if connected
exitwhile
endif
endif
if not null no3
call dodial with no3
if connected
exitwhile
endif
endif
if not null no4
call dodial with no4
if connected
exitwhile
endif
endif
if not null no5
call dodial with no5
if connected
exitwhile
endif
endif
if not null no6
call dodial with no6
if connected
exitwhile
endif
endif
if not null no7
call dodial with no7
if connected
exitwhile
endif
endif
if not null no8
call dodial with no8
if connected
exitwhile
endif
endif
if not null no9
call dodial with no9
if connected
exitwhile
endif
endif
endwhile
set keys off
endproc
proc dodial
strparm nv
string response
integer rings = 0
hangup
fatsay 9 12 cwin "Calling %s at %s" $D_NAME nv
fatsay 10 12 cwin "Will wait for %d rings" RingWait
fatsay 11 12 cwin "connect script: %s" $D_PHONE
rflush
locate 21 0
if hitkey
call dokey
endif
transmit PCdial
transmit nv
transmit PCsufx
ringin:
locate 21 0
rget response 80 ConnectWait
if failure
call showstat with "Timed out"
return
endif
rget response
if hitkey
call dokey
endif
find response "CONNECT"
if found
call doconnect with nv response
hangup
return
endif
find response "RINGING"
if found
rings = rings + 1
rflush
strfmt response "Ring number %d" rings
call showstat with response
if gt rings RingWait
hangup
return
endif
goto ringin
endif
call showstat with response
endproc
proc showstat
strparm msg
string msg2
integer lfc
strpeek msg 0 lfc
if EQ lfc 10
substr msg2 msg 1 30
else
substr msg2 msg 0 30
endif
fatsay 14 12 cwin "Last Stat: %-20s" msg2
endproc
proc dokey
integer k
keyget k
hangup
kflush
if EQ k 32
call showstat with "Recycle"
return
else
call showstat with "Key press abort"
exit
endif
endproc
proc doconnect
strparm nv
strparm conmess
string msg2
integer lfc
tooslow = 0
strpeek conmess 0 lfc
if EQ lfc 10
substr msg2 conmess 1 38
else
substr msg2 conmess 0 38
endif
find msg2 "14400"
if not found
find msg2 "9600"
if not found
find msg2 "2400"
if not found
find msg2 "1200"
if found
call speedchk with 1200L
else
call speedchk with $D_BAUD
endif
else
call speedchk with 2400L
endif
else
call speedchk with 9600L
endif
else
call speedchk with 19200L
endif
if tooslow
return
endif
clear
atsay 0 0 cnorm msg2
fatsay 1 0 cnorm "Online to %s at %s" $D_NAME nv
locate 2 0
alarm
if not null autoLOG
log open autoLOG
endif
if not null $D_PHONE
execute $D_PHONE
else
exit
endif
endproc
proc speedchk
longparm spd
if LT spd lowSPD
call showstat with "Too slow!!!"
tooslow = 1
return
endif
if PCauto
set baudrate spd
endif
endproc
proc config
string ConfigFile = configdir
atsay ln pos cnorm "Initializing"
call pg
;*** set default values
fetch modem dialcmnd PCdial
fetch modem dialsuffix PCsufx
fetch modem init ModemInit
fetch modem waitcnct ConnectWait
fetch modem autobaud PCauto
if not null $D_NOTE
strcat ConfigFile $D_NOTE
strcat ConfigFile ".HNT"
findfirst ConfigFile
if found
call Fconfig with ConfigFile
else
ConfigFile = configdir
strcat ConfigFile $D_NOTE
strcat ConfigFile ".NOT"
findfirst ConfigFile
if found
call Fconfig with ConfigFile
else
ConfigFile = ""
endif
endif
else
atsay 21 pos cerr "ERROR: you must specify a configuration file in NOTE FILE:"
exit
endif
if null ConfigFile
atsay 21 pos cerr "ERROR: Unable to locate configuration file"
exit
endif
if null no1
if null no2
if null no3
if null no4
if null no5
if null no6
if null no7
if null no8
if null no9
atsay 21 pos cerr "ERROR: no phone numbers found"
exit
endif
endif
endif
endif
endif
endif
endif
endif
endif
call initmodem
endproc
proc Fconfig
strparm cfile
string fl
string fl1
string fl2
integer num
Fatsay ln pos cnorm "Reading configuration file %s" cfile
call pg
set fgets_crlf off
fopen 0 cfile "rt"
if success
locate ln 0
fgets 0 fl
message fl
call pg
find fl "#HUNT"
if found
while not EOF 0
fgets 0 fl
message fl
call pg
strpeek fl 1 num
if EQ num 35
loopwhile
endif
substr fl1 fl 0 3
substr fl2 fl 4 80
strlwr fl1
switch fl1
case "n1 "
no1 = fl2
endcase
case "n2 "
no2 = fl2
endcase
case "n3 "
no3 = fl2
endcase
case "n4 "
no4 = fl2
endcase
case "n5 "
no5 = fl2
endcase
case "n6 "
no6 = fl2
endcase
case "n7 "
no7 = fl2
endcase
case "n8 "
no8 = fl2
endcase
case "n9 "
no9 = fl2
endcase
case "mi "
ModemInit = fl2
endcase
case "ms "
ModemSet = fl2
endcase
case "rw "
atoi fl2 RingWait
endcase
case "cw "
atoi fl2 ConnectWait
endcase
case "spd"
atol fl2 lowSPD
endcase
case "log"
autoLOG = fl2
endcase
case "end"
exitwhile
endcase
endswitch
endwhile
else
fatsay ln pos cerr "%s is not a valid HUNT configuration file" cfile
exit
endif
fclose 0
endif
endproc
proc initmodem
locate 21 0
if not null ModemInit
find ModemInit PCsufx
if not found
strcat ModemInit PCsufx
endif
transmit ModemInit
waitfor "OK" 30
pause 1
endif
locate 21 0
if not null ModemSet
find ModemSet PCsufx
if not found
strcat ModemSet PCsufx
endif
transmit ModemSet
waitfor "OK" 10
endif
endproc
proc pg
inc ln
if EQ ln 24
ln = 2
locate 2 0
eeos
endif
endproc